import instacne from "../request";
import * as qs from 'qs';
// 营销活动的相关数据 /flash/list
export const flashListInfo = (params:{
    pageNum : number,
    pageSize : number
}) :Promise<{
    list : any[],
    pageSize : number,
    pageNum : number,
    [type : string] : any
}> => instacne.get(`/flash/list`,{params})

// 删除活动操作 /mall-admin/flash/delete/{id}
export const FlashDelete = (params : { 
    id : string
})=>instacne.post(`/flash/delete/${params.id}`)

//添加活动信息/mall-admin/flash/create

export const FlashCreate = (params : any)=>instacne.post(`/flash/create`,params)  




//优惠券列表全部   根据多个信息 搜索也是在这里进行 /coupon/list 
export const couponList = (params : {
    name? : string,
    pageNum? : number,
    pageSize? :number,
    type? : string
}) :Promise<any> => instacne.get('/coupon/list',{params})


// 删除优惠券/coupon/delete/{id}
export const deleteCupon = (id:number) => instacne.post(`/coupon/delete/${id}`)

// 获取单个优惠券的详细信息/coupon/{id}
export const getOneCupon = (id : any) =>  instacne.get(`/coupon/${id}`) 

///mall-admin/couponHistory/list 根据优惠券id，使用状态，订单编号分页获取领取记录
export const couponHistoryList = (params:{
    couponId? : any,
    orderSn? : any,
    pageNum : number,
    pageSize : number,
    useStatus? : any
}):Promise<{
    list : Array<any>,
    pageNum : number,
    pageSize : number,
    totalPage : number
}> =>instacne.get('/couponHistory/list',{params})

//  修改优惠券 /coupon/update/{id}
export const updateCoupon = (id:number):Promise<any> => instacne.get(`/coupon/update/${id}`)

// 品牌推荐区 
//  home/brand/list   获取列表
export const brandListComment = (params:{
    brandName? : string,
    pageNum : number,
    pageSize : number,
    recommendStatus? : number
}):Promise<any> => instacne.get('/home/brand/list' , {params})

// 删除某一条数据 /home/brand/delete ids 批量
export const deleteList = (ids : string)=>instacne.post(`/home/brand/delete` , qs.stringify({ids:ids}))

// 修改推荐状态 /home/brand/update/recommendStatus  批量
export const updateRecommendStatus = (params  :{
    ids : number | Array<number> | string,
    recommendStatus : number
})=>instacne.post('/home/brand/update/recommendStatus' , qs.stringify( {ids:params.ids , recommendStatus:params.recommendStatus}) )


// 新品 -----
//  home/newProduct/list  获取列表
export const newProductListComment = (params:{
    brandName? : string,
    pageNum : number,
    pageSize : number,
    recommendStatus? : number
}):Promise<any> => instacne.get('/home/newProduct/list' , {params})

// 删除某一条数据 /home/brand/delete ids 批量
export const deleteProductList = (ids : string)=>instacne.post(`/home/newProduct/delete` , qs.stringify({ids:ids}))
// 修改推荐状态/home/newProduct/update/recommendStatus  批量
export const updatenewProductStatus = (params  :{
    ids : number| Array<number> | string,
    recommendStatus : number
})=>instacne.post('/home/newProduct/update/recommendStatus' , qs.stringify( {ids:params.ids , recommendStatus:params.recommendStatus}) )




// 人气
//  home/recommendProduct/list   获取列表
export const recommendProductList = (params:{
    brandName? : string,
    pageNum : number,
    pageSize : number,
    recommendStatus? : number
}):Promise<any> => instacne.get('/home/recommendProduct/list' , {params})

// 删除某一条数据 /home/brand/delete ids 批量
export const deleteRecommendProductList = (ids : string)=>instacne.post(`/home/recommendProduct/delete` , qs.stringify({ids:ids}))
// 修改推荐状态 /home/recommendProduct/update/recommendStatus  批量
export const updaterecommendProductStatus = (params  :{
    ids : number| Array<number> | string,
    recommendStatus : number
})=>instacne.post('/home/recommendProduct/update/recommendStatus' , qs.stringify( {ids:params.ids , recommendStatus:params.recommendStatus}) )



//专题
//  /home/recommendSubject/list   获取列表
export const brandRecommendSubjectList = (params:{
    brandName? : string,
    pageNum : number,
    pageSize : number,
    recommendStatus? : number
}):Promise<any> => instacne.get('/home/recommendSubject/list' , {params})

// 删除某一条数据 /home/brand/delete ids 批量
export const deleteRecommendSubjectList = (ids : string)=>instacne.post(`/home/recommendSubject/delete` , qs.stringify({ids:ids}))
// 修改推荐状态 /home/recommendSubject/update/recommendStatus  批量
export const updaterecommendSubject = (params  :{
    ids : number| Array<number> | string,
    recommendStatus : number
})=>instacne.post('/home/recommendSubject/update/recommendStatus' , qs.stringify( {ids:params.ids , recommendStatus:params.recommendStatus}) )
